This file contains updated information for the Addison-Wesley Macintosh programming title "A Fragment of Your Imagination" written by Joe Zobkiw. For updated information visit the web site at http://www.triplesoft.com/fragment/
Corrupt Data
The copy of the source code on the CW7 CD from Metrowerks contains some corrupt files. You can obtain a non-corrupt version from the Metrowerks WWW site at <http://www.metrowerks.com>
Control Panel Native Code
The source code for the control panel chapter contains a compiled control panel. The only caveat is that the control panel is compiled for PowerPC. Therefore, if you double-click the control panel on a 680x0 Macintosh, it will crash with an unimplemented instruction. Simply build the 680x0 cdev project before running the control panel on your 680x0 Macintosh.
New Macros (CodeWarrior 7)
CodeWarrior 7 includes new macros to help make your code resource source code more transparent when writing for both 680x0 and PowerPC processors.
The file A4Stuff.h contains:
#ifndef powerc
#define EnterCodeResource() long oldA4 = SetCurrentA4()
#define ExitCodeResource() SetA4(oldA4)
long SetCurrentA4(void);
long SetA4(long:__D0):__D0 = 0xC18C;
long GetCurrentA4(void) = 0x200C;
pascal void UnloadA4Seg(void *);
#else
#define EnterCodeResource()
#define ExitCodeResource()
#define SetCurrentA4() 0L
#define SetA4(x) 0L
#define GetCurrentA4() 0L
#define UnloadA4Seg(x) 0
#endif
The file SetUpA4.h contains:
#ifndef powerc
#define PrepareCallback() RememberA4()
#define EnterCallback() long oldA4 = SetUpA4()
#define ExitCallback() RestoreA4(oldA4)
static void RememberA4(void);
static asm long SetUpA4(void)
{
move.l a4,d0
lea storage,a4
move.l (a4),a4
rts
storage: dc.l 0 /* this storage is only referenced thru data cache */
entry static RememberA4
lea storage,a0
move.l a4,(a0)
rts
}
static long RestoreA4(long:__D0):__D0 = 0xC18C;
#else
#define PrepareCallback()
#define EnterCallback()
#define ExitCallback()
#define RememberA4() 0
#define SetUpA4() 0L
#define RestoreA4(x) 0L
#endif
You should read the comments in each file for complete information on how to use these new macros. They will make your coding life much easier and make your code easier to read.